<template>
	<base-page title="佣金协议签约" backgroundColor="white">
		<view class="flex-col center w-full mt-40 px-16">
			<image style="width:92px;height:100px;" src="@/pagesB/static/img-sign.png"></image>
			<view class="text-color-regular fs-16 font-semibold leading-22 mt-28">协议签约</view>
			<view class="fs-12 text-color-hint text-center leading-17 mt-8">为保证您的资金安全及佣金收入的合规性，请您阅读并签署佣金代发协议</view>
			<view class="radius-8 bg-primary h-46 w-full flex center text-white fs-16 font-normal mt-28" @click="toSign">去签约</view>
			<view class="mt-12 leading-17 text-color-hint fs-12">若签约过期或其他问题，请 <button class="inline-flex transparent m-0 p-0 leading-17 fs-12 color-secondary-info" open-type="contact">联系客服</button>。</view>
		</view>
	</base-page>
</template>

<script setup name="Sign">
	import { getCurrentInstance } from 'vue'
	
	const instance = getCurrentInstance()
	
	/**
	 * 点击签约，进入签约链接，签约完成返回小程序，查询签约状态
	 * 签约成功，返回提现页面，toast“银行卡绑定成功”
	 * 签约失败，返回签约页面，toast“签约失败”
	 */
	const toSign = () => {
		const eventChannel = instance.ctx.getOpenerEventChannel()
		eventChannel.emit('onSignResult', { result: true })
		uni.navigateBack()
		uni.showToast({
			title: '银行卡绑定成功',
			icon: 'none'
		})
	}
</script>
